﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace rClr.Samples
{
    public class DataConversionSample
    {
        public static DateTime GetDate(string datetime)
        {
            return DateTime.Parse(datetime);
        }

        public static string DateTimeToString(DateTime dt)
        {
            return dt.ToString();
        }

        public static double[] GetOneDimArray(int length)
        {
            var result = new double[length];
            for (int i = 0; i < length; i++)
                result[i] = 1.1 * i;
            return result;
        }

        public static string[] GetOneDimStringArray(int length)
        {
            var result = new string[length];
            for (int i = 0; i < length; i++)
                result[i] = i.ToString();
            return result;
        }

        public static double[,] GetRectArray(int lengthZero, int lengthOne)
        {
            var result = new double[lengthZero, lengthOne];
            for (int i = 0; i < lengthZero; i++)
                for (int j = 0; j < lengthOne; j++)
                    result[i,j] = 1.1 * i + 0.22 * j;
            return result;
        }
    }
}
